<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>upload</title>
    <script src="./jquery/jquery-3.1.0.min.js"></script>
</head>
<body>
<h1>jquery-upload-file</h1>
<div id="res"></div>
<input type="file" name="file" id="file">
<input type="button" value="上传" onclick="jqueryupload()"></input>

<script type="text/javascript">
     function jqueryupload() {
         alert("hhahha")
         var file = $("#file")[0].files[0];
         var form  = new FormData();
         form.append("file",file);

         $.ajax({
             type: "post",
             url:"/jqueryupload",
             contentType: false,
             processData: false,
             data:form,
             success:function (msg) {
              $("#res").html(msg)
             }



         })
     }
</script>
</body>
</html>
